# 代码 3-6 将十进制转化为任意进制
from pythonds.basic import Stack


def baseConverter(decNumber,base):
    remstack=Stack()
    newString=""
    digits="0123456789ABCDEF"
    while decNumber>0:
        rem=decNumber%base
        remstack.push(rem)
        decNumber=decNumber//base
    while not remstack.isEmpty():
        newString+=digits[remstack.pop()]
    return newString

b=baseConverter(233,8)
print(b)#351
print(oct(233))#0o351